<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {

	/**
	 * 用户登录
	 */
	public function index(){	
		$this->load->library('Cismarty');
		$this->load->model('Authority');
		$userName=$_POST['userName'];
		$password=$_POST['password'];
		if(!empty($userName)&&!empty($password)){
			$result=$this->Authority->getLoginUser($userName,$password);
		}
		if(!$result||count($result)==0){
			$this->load->library('session');
			$userName=$this->session->userdata('username');
			$this->cismarty->assign('userName',$userName); 
			$this->cismarty->assign('baseUrl',$this->config->item('base_url')); 
			$this->cismarty->assign('loginMsg','用户名或密码错误，请重新登录！'); 
			$this->cismarty->display('login.tpl'); 
			exit;
		}else{
			echo $result[0]->birthday;
		}
		
		//$this->cismarty->assign('nickname',$result->nickname);  
		//$this->cismarty->assign('password',$password);  
		//$this->cismarty->assign('password',$password);  
	}
	/**
	 * 通过用户ID去读取对应的权限
	 * 实使化用户菜单
	 */
//	public function getMenuById(userId)
//	{	
//		
//	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */